import { setToken, getToken, removeToken } from '@/utils/auth'
export default {
  namespaced: true,
  state: {
    token: getToken() || '',
    userInfo: {}
  },
  mutations: {
    setToken(state, newToken) {
      state.token = newToken
      setToken(newToken)
    },
    setUserInfo(state, newInfo) {
      state.userInfo = newInfo
    },
    removeToken(state) {
      state.token = ''
      state.userInfo = {}
      removeToken()
    }
  },
  actions: {

  }
}
